import React, {Component} from 'react'
import '../../static/scss/dataCenter/dataManagement.scss'
import {Redirect, Route, Switch} from "react-router";
import homeChildAPP from "./homeChild";
import homeChild2APP from "./homeChild2";

class proManagementApp extends Component {
    state = {
        routes: [
            {path: 'homeChildAPP', component: homeChildAPP},
            {path: 'homeChild2APP', component: homeChild2APP}
        ],
    }

    render() {
        const {routes} = this.state;
        const path = '/view/homePage'
        return (
            <>
                <Route path={path} exact render={() => <Redirect to={`${path}/${routes[0].path}`}/>}/>
                <Switch>
                    {routes.map((item, i) =>
                        <Route key={i} path={`${path}/${item.path}`}
                               component={props => <item.component {...props}/>}/>
                    )}
                </Switch>
            </>
        )
    }
}

export default proManagementApp;